<?php
/*********************/
/*                   */
/* http://www.ymd.cc */
/*********************/
/*    QQ: 11121426   */
/*                   */
/*********************/

function tpl_modifier_timeleft($string)
{
    $diff = ($string - time()) / 60;
    $abs_diff = abs($diff);
    if ($abs_diff < 60) {
        $t = round($abs_diff) . "分钟";
    } else if ($abs_diff < 1440) {
        $t = round($abs_diff / 60) . "小时";
    } else {
        $t = round($abs_diff / 1440) . "天";
    }
    return 0 < $diff ? $t : "已过去" . $t;
}

?>
